package com.ljkj.blockpay.presenter;

import android.accounts.Account;
import android.content.Context;

import androidx.annotation.NonNull;

import com.kongzue.baseokhttp.HttpRequest;
import com.kongzue.baseokhttp.listener.JsonResponseListener;
import com.kongzue.baseokhttp.util.JsonMap;
import com.kongzue.baseokhttp.util.Parameter;
import com.ljkj.blockpay.basedata.BasePresenterImpl;
import com.ljkj.blockpay.basedata.BaseView;
import com.ljkj.blockpay.network.ApiToCConfig;

/**
 * Created by yp on 2022/3/2
 */
public class AccountsSecurityPresenter extends BasePresenterImpl<SecurityInter.SecurityInterView> implements SecurityInter.SecurityInterPresenterView{

    public AccountsSecurityPresenter(@NonNull Context context, @NonNull SecurityInter.SecurityInterView view) {
        super(context, view);
    }


    @Override
    public void accountSecurity() {
        HttpRequest.GET(getContext(), ApiToCConfig.USER_SECURITY, new Parameter(), new JsonResponseListener() {
            @Override
            public void onResponse(JsonMap main, Exception error) {
                if (main.getInt("code") == 0){
                    JsonMap jsonMap= main.getJsonMap("data");
                    getView().securitySuccess(jsonMap);
                }
            }
        });
    }
}
